home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / srchlp.zip / BAGGAGE.H next >
C/C++ Source or Header  |  1993-09-16  |  19KB  |  637 lines

  1.  
  2. /**************************************************************************\
  3. *
  4. *  IMPDLL.H
  5. *
  6. *  Copyright (C) Microsoft Corporation 1990.
  7. *  All rights reserved.
  8. *
  9. ****************************************************************************
  10. *
  11. *  Program Description:   Import routine export header for DLLs
  12. *
  13. *****************************************************************************
  14. *
  15. *  Revision History:   Created 10/22/90 by Robert Bunney
  16. *
  17. *
  18. *****************************************************************************
  19.  
  20. *
  21. *  Known Bugs:   None
  22. *
  23. *
  24. \***************************************************************************/
  25.  
  26. /***************************************************************************\
  27. *
  28. *  Defines
  29. *
  30. \***************************************************************************/
  31.  
  32. /* magic number and version number */
  33.  
  34. /* file mode flags */
  35.  
  36. #define fFSReadOnly    (BYTE)0x01     /* file (FS) is readonly */
  37. #define fFSOpenReadOnly    (BYTE)0x02     /* file (FS) is opened in readonly mode */
  38.  
  39.  
  40. #define fFSReadWrite    (BYTE)0x00     /* file (FS) is readwrite */
  41. #define fFSOpenReadWrite    (BYTE)0x00     /* file (FS) is opened in read/write mode */
  42.  
  43.  
  44. /* flags for FlushHfs */
  45.  
  46. #define fFSCloseFile    (BYTE)0x01
  47. #define fFSFreeBtreeCache    (BYTE)0x02
  48.  
  49. /* seek origins */
  50.  
  51. #define wFSSeekSet    0
  52. #define wFSSeekCur    1
  53. #define wFSSeekEnd    2
  54.  
  55. /* low level info options */
  56.  
  57. #define wLLSameFid    0
  58. #define wLLDupFid    1
  59. #define wLLNewFid    2
  60.  
  61. /* Exported functions        */
  62.  
  63.  
  64. #define HE_Count    26          /* count of exported functions */
  65. #define HE_Documented    17          /* number documented for Help 3.1 */
  66.  
  67. #define HE_NotUsed    0
  68. #define HE_HfsOpenSz    1
  69. #define HE_RcCloseHfs    2
  70. #define HE_HfOpenHfs    3
  71. #define HE_RcCloseHf    4
  72. #define HE_LcbReadHf    5
  73. #define HE_LTellHf    6
  74. #define HE_LSeekHf    7
  75. #define HE_FEofHf    8
  76. #define HE_LcbSizeHf    9
  77. #define HE_FAccessHfs    10
  78. #define HE_RcLLInfoFromHf    11
  79. #define HE_RcLLInfoFromHfs    12
  80. #define HE_ErrorW    13
  81.  
  82. #define HE_ErrorSz    14
  83. #define HE_GetInfo    15
  84. #define HE_API    16
  85.  
  86. /* Return codes           */
  87.  
  88. #define rcSuccess    0
  89. #define rcFailure    1
  90. #define rcExists    2
  91. #define rcNoExists    3
  92. #define rcInvalid    4
  93. #define rcBadHandle    5
  94. #define rcBadArg    6
  95. #define rcUnimplemented    7
  96. #define rcOutOfMemory    8
  97. #define rcNoPermission    9
  98. #define rcBadVersion    10
  99. #define rcDiskFull    11
  100. #define rcInternal    12
  101. #define rcNoFileHandles    13
  102. #define rcFileChange    14
  103. #define rcTooBig    15
  104.  
  105.  
  106. /**
  107. * Errors for Error()
  108. **/
  109.  
  110. /* Errors to generate        */
  111.  
  112. #define wERRS_OOM    2         /* Out of memory                             */
  113. #define wERRS_NOHELPPS    3         /* No Help during printer setup     */
  114. #define wERRS_NOHELPPR    4         /* No Help while printing                 */
  115. #define wERRS_FNF    1001    /* Cannot find file                             */
  116. #define wERRS_NOTOPIC    1002    /* Topic does not exist                   */
  117. #define wERRS_NOPRINTER    1003    /* Cannot print                                  */
  118.  
  119. #define wERRS_PRINT    1004
  120. #define wERRS_EXPORT    1005    /* Cannot copy to clipboard           */
  121. #define wERRS_BADFILE    1006
  122. #define wERRS_OLDFILE    1007
  123. #define wERRS_Virus    1011    /* Bad .EXE                                          */
  124. #define wERRS_BADDRIVE    1012    /* Invalid drive                                   */
  125. #define wERRS_WINCLASS    1014    /* Bad window class                        */
  126. #define wERRS_BADKEYWORD    3012    /* Invalid keyword                            */
  127.  
  128. #define wERRS_BADPATHSPEC    3015    /* Invalid path specification            */
  129. #define wERRS_PATHNOTFOUND    3017    /* Path not found                               */
  130. #define wERRS_DIALOGBOXOOM    3018    /* Insufficient memory for dialog  */
  131. #define wERRS_DiskFull    5001    /* Disk is full                                       */
  132. #define wERRS_FSReadWrite    5002    /* File read/write failure                   */
  133.  
  134. /**
  135. * Actions for LGetInfo()
  136. **/
  137.  
  138. #define GI_NOTHING    0         /* Not used                                                      */
  139.  
  140. #define GI_INSTANCE    1         /* Application instance handle                    */
  141. #define GI_MAINHWND    2         /* Main window handle                                 */
  142. #define GI_CURRHWND    3         /* Current window handle                            */
  143. #define GI_HFS    4         /* Handle to file system in use                    */
  144. #define GI_FGCOLOR    5         /* Foreground color used by application   */
  145. #define GI_BKCOLOR    6         /* Background color used by application   */
  146.  
  147. #define GI_TOPICNO    7         /* Topic number                                              */
  148. #define GI_HPATH    8         /* Handle containing path -- caller               */
  149.  
  150.                /*  must free           */
  151.  
  152.  
  153. /***************************************************************************\
  154. *
  155. *            Types
  156. *
  157. \***************************************************************************/
  158.  
  159. typedef WORD RC;    /* Error return (return code)     */
  160. typedef HANDLE HFS;    /* Handle to a file system           */
  161.  
  162. typedef HANDLE HF;    /* Handle to a file system file    */
  163.  
  164. /***************************************************************************\
  165. *
  166. *            Prototypes
  167. *
  168. \***************************************************************************/
  169.  
  170. VOID FAR PASCAL SetCallbacks(FARPROC FAR *);
  171.  
  172.  
  173. /***************************************************************************\
  174. *
  175. *            Public Functions pointers
  176. *
  177. \***************************************************************************/
  178.  
  179.  
  180. /***************************************************************************\
  181. *
  182. * Function:   RcGetFSError()
  183. *
  184. * Purpose:   return the most recent FS error code
  185. *
  186. * Method:   give value of last error that the file system encountered
  187. *
  188. * ASSUMES
  189. *
  190. *  globals IN:   rcFSError - current error code; set by most recent FS call
  191. *
  192. * PROMISES
  193. *
  194. *  returns:   returns current error in file system
  195. *
  196. \***************************************************************************/
  197.  
  198.  
  199. extern RC  (FAR PASCAL *RcGetFSError)(void);
  200.  
  201. /***************************************************************************\
  202. *
  203. * Function:   HfsOpenSz( sz, bFlags )
  204. *
  205. * Purpose:   open a file system
  206. *
  207. * ASSUMES
  208. *
  209. *  args IN:   sz - path to file system to open
  210.               bFlags - fFSOpenReadOnly or fFSOpenReadWrite
  211. *
  212. * PROMISES
  213. *
  214. *  returns:   handle to file system if opened OK, else hNil
  215. *
  216. \***************************************************************************/
  217.  
  218.  
  219. extern HFS (FAR PASCAL *HfsOpenSz)( LPSTR, BYTE );
  220.  
  221.  
  222. /***************************************************************************\
  223. *
  224. * Function:   RcCloseHfs( hfs )
  225. *
  226. * Purpose:   Close an open file system
  227. *        All files must be closed or changes made will be lost
  228. *
  229. * ASSUMES
  230. *
  231. *  args IN:   hfs - handle to an open file system
  232. *
  233. * PROMISES
  234. *
  235. *  returns:   standard return code
  236. *
  237. *  globals OUT:   rcFSError
  238. *
  239. \***************************************************************************/
  240.  
  241.  
  242. extern HFS (FAR PASCAL *RcCloseHfs)( HFS );
  243.  
  244.  
  245. /***************************************************************************\
  246. *
  247. * Function:   HfOpenHfs( hfs, sz, bFlags )
  248. *
  249. * Purpose:   open a file in a file system
  250. *
  251. * ASSUMES
  252. *
  253. *  args IN:   hfs - handle to file system
  254.               sz - name (key) of file to open
  255.               bFlags -
  256. *
  257. * PROMISES
  258. *
  259. *  returns:   handle to open file or hNil on failure
  260. *
  261. * Notes:   strlen( qNil ) and strcpy( s, qNil ) don't work as they should
  262.  
  263. *
  264. \***************************************************************************/
  265.  
  266. extern HF  (FAR PASCAL *HfOpenHfs    ) ( HFS,  LPSTR,  BYTE );
  267.  
  268. /***************************************************************************\
  269. *
  270. * Function:   RcCloseHf( hf )
  271. *
  272. * Purpose   close an open file in a file system
  273. *
  274. * Method:   If the file is dirty, copy the scratch file back to the FS file.
  275. *                   If this is the first time the file has been closed, enter the
  276.  
  277. *                   name into the FS directory. If this file is the FS directory,
  278. *                   store the location in a special place instead. Write the FS
  279. *                   directory and header to disk. Do other various hairy stuff.
  280. *
  281. * ASSUMES
  282. *
  283. *  args IN:   hf - file handle
  284. *
  285. * PROMISES
  286. *
  287. *  returns:   rcSuccess on successful closing
  288. *
  289. \***************************************************************************/
  290.  
  291. extern RC  (FAR PASCAL *RcCloseHf    ) ( HF         );
  292.  
  293.  
  294. /***************************************************************************\
  295. *
  296. * Function:   LcbReadHf()
  297. *
  298. * Purpose:   read bytes from a file in a file system
  299. *
  300. * ASSUMES
  301. *
  302. *  args IN:   hf - file
  303.               lcb - number of bytes to read
  304. *
  305. * PROMISES
  306. *
  307. *  returns:   number of bytes actually read; -1 on error
  308. *
  309. *  args OUT:   qb - data read from file goes here (must be big enough)
  310. *
  311. *  Notes:   These are signed longs we're dealing with. This means
  312.  
  313. *                 behavior is different from read() when < 0.
  314. *
  315. \***************************************************************************/
  316.  
  317. extern LONG (FAR PASCAL *LcbReadHf    ) ( HF,  LPSTR, LONG );
  318.  
  319. /***************************************************************************\
  320. *
  321. * Function:   LcbWriteHf( hf, qb, lcb )
  322. *
  323. * Purpose:   write the contents of buffer into file
  324. *
  325. * Method:   If file isn't already dirty, copy data into temporary file.
  326. *                   Do the write.
  327.  
  328. *
  329. * ASSUMES
  330. *
  331. *  args IN:   hf - file
  332. *                  qb - user's buffer full of stuff to write
  333. *                  lcb - number of bytes of qb to write
  334. *
  335. * PROMISES
  336. *
  337. *  returns:   number of bytes written if successful, -1L if not
  338. *
  339. *  args OUT:   hf - lifCurrent, lcbFile updated; dirty flag set
  340. *
  341. *  globals OUT:   rcFSError
  342. *
  343. \***************************************************************************/
  344.  
  345. extern LONG (FAR PASCAL *LcbWriteHf    ) ( HF,  LPSTR, LONG );
  346.  
  347.  
  348. /***************************************************************************\
  349. *
  350. * Function:   LTellHf( hf )
  351. *
  352. * Purpose:   return current file position
  353. *
  354. * ASSUMES
  355. *
  356. *  args IN:   hf - handle to open file
  357. *
  358. * PROMISES
  359. *
  360. *  returns:   file position
  361. *
  362. \***************************************************************************/
  363.  
  364. extern LONG (FAR PASCAL *LTellHf     ) ( HF         );
  365.  
  366. /***************************************************************************\
  367.  
  368. *
  369. * Function:   LSeekHf( hf, lOffset, wOrigin )
  370. *
  371. * Purpose:   set current file pointer
  372. *
  373. * ASSUMES
  374. *
  375. *  args IN:   hf   - file
  376. *                   lOffset - offset from origin
  377. *                   wOrigin - origin (wSeekSet, wSeekCur, or wSeekEnd)
  378. *
  379. * PROMISES
  380. *
  381. *  returns:   new position offset in bytes from beginning of file if
  382. *                    successful, or -1L if not
  383. *
  384. *  state OUT:   file pointer is set to new position unless error occurs,
  385. *                        in which case it stays where it was
  386.  
  387. *
  388. \***************************************************************************/
  389.  
  390. extern LONG (FAR PASCAL *LSeekHf     ) ( HF,  LONG, WORD );
  391.  
  392. /***************************************************************************\
  393. *
  394. * Function:   FEofHf()
  395. *
  396. * Purpose:   tell whether file pointer is at end of file
  397. *
  398. * ASSUMES
  399. *
  400. *  args IN:   hf
  401. *
  402. * PROMISES
  403. *
  404. *  returns:   fTrue if file pointer is at EOF, fFalse otherwise
  405. *
  406. \***************************************************************************/
  407.  
  408.  
  409. extern BOOL (FAR PASCAL *FEofHf      ) ( HF         );
  410.  
  411. /***************************************************************************\
  412. *
  413. * Function:   LcbSizeHf( hf )
  414. *
  415. * Purpose:   return the size in bytes of specified file
  416. *
  417. * ASSUMES
  418. *
  419. *  args IN:   hf - file handle
  420. *
  421. * PROMISES
  422. *
  423. *  returns:   size of the file in bytes
  424. *
  425. \***************************************************************************/
  426.  
  427. extern LONG (FAR PASCAL *LcbSizeHf    ) ( HF         );
  428.  
  429.  
  430. /***************************************************************************\
  431. *
  432. * Function:   FAccessHfs( hfs, sz, bFlags )
  433. *
  434. * Purpose:   determine existence or legal access to an FS file
  435. *
  436. * ASSUMES
  437. *
  438. *  args IN:   hfs
  439. *                  sz   - file name
  440. *                  bFlags - ignored
  441. *
  442. * PROMISES
  443. *
  444. *  returns:   fTrue if file exists (is accessible in stated mode),
  445. *                    fFalse otherwise
  446. *
  447. * Bugs:   access mode part is unimplemented
  448.  
  449. *
  450. \***************************************************************************/
  451.  
  452. extern BOOL (FAR PASCAL *FAccessHfs    ) ( HFS,  LPSTR, BYTE );
  453.  
  454. /*******************
  455.  -
  456.  - Name:   ErrorW
  457.  *
  458.  * Purpose:   displays an error message
  459.  *
  460.  * Arguments:   nError - string identifier. See wERRS_* messages.
  461.  *
  462.  * Returns:   nothing
  463.  *
  464.  ******************/
  465.  
  466. extern VOID (FAR PASCAL *ErrorW      ) ( int );
  467.  
  468. /***************************************************************************
  469.  
  470.  *
  471.  - Name:   ErrorSz
  472.  -
  473.  * Purpose:   displays standard Windows Help error message dialog based on
  474.  *                     the string passed
  475.  *
  476.  * Arguments:   lpstr - string to display
  477.  *
  478.  * Returns:   nothing
  479.  *
  480.  ***************************************************************************/
  481.  
  482. extern VOID (FAR PASCAL *ErrorSz    ) ( LPSTR );
  483.  
  484. /***************************************************************************
  485.  *
  486.  - Name:   LGetInfo
  487.  -
  488.  * Purpose:   gets global information from the application
  489.  
  490.  *
  491.  * Arguments:   hwnd - window handle of topic to query.
  492.  *                          wItem - item to get
  493.  *                          GI_INSTANCE - application instance handle
  494.  *                          GI_MAINHWND - main window handle
  495.  *                          GI_CURRHWND - current window handle
  496.  *                          GI_HFS - handle to file system in use
  497.  *                          GI_FGCOLOR - foreground color used by application
  498.  *                          GI_BKCOLOR - background color used by application
  499.  
  500.  *                          GI_TOPICNO - topic number
  501.  *                          GI_HPATH - handle containing path -- caller must free
  502.  *
  503.  *
  504.  * Notes:   if the HWND is NULL, then the data will come from the window
  505.  *               that currently has the focus
  506.  *
  507.  ***************************************************************************/
  508.  
  509.  
  510. extern LONG (FAR PASCAL *LGetInfo     ) ( WORD, HWND     );
  511.  
  512. /*******************
  513.  -
  514.  - Name:   FAPI
  515.  *
  516.  * Purpose:   post a message for Help requests
  517.  
  518.  *
  519.  * Arguments:   qchHelp - path (if not current directory) and file to use for Help topic
  520.  *                          usCommand - command to send to Help
  521.  *                          ulData - data associated with command
  522.  *
  523.  *
  524.  * Returns:   TRUE iff success
  525.  *
  526.  * Notes:   see the Chapter 19 entry for the WinHelp API
  527.  *
  528.  ******************/
  529.  
  530. extern LONG (FAR PASCAL *FAPI       ) ( LPSTR, WORD, DWORD );
  531.  
  532. /***************************************************************************\
  533.  
  534. *
  535. - Function:   RcLLInfoFromHf( hf, wOption, qfid, qlBase, qlcb )
  536. -
  537. * Purpose:   map an HF into low-level file info
  538. *
  539. * ASSUMES
  540. *  args IN:   hf - an open HF
  541. *                  qfid, qlBase, qlcb - pointers to user's variables
  542. *                  wOption - wLLSameFid, wLLDupFid, or wLLNewFid
  543. *
  544. * PROMISES
  545. *  returns:   RcFSError(); rcSuccess on success
  546. *
  547. *  args OUT:   qfid - depending on value of wOption, either the same fid
  548. *                                 used by hf, a dup() of this fid, or a new fid obtained
  549.  
  550. *                                 by reopening the file
  551. *
  552. *                       qlBase - byte offset of first byte in the file
  553. *                       qlcb - size in bytes of the data in the file
  554. *
  555. *  globals OUT:   rcFSError
  556. *
  557. * Notes:   It is possible to read data outside the range specified by *qlBase
  558. *               and *qlcb. Nothing is guaranteed about what will be found there.
  559. *               If wOption is wLLSameFid or wLLDupFid, and the FS is opened in
  560.  
  561. *               opened in write mode, this fid will be writable. However, writing
  562. *               is not allowed and may destroy the file system.
  563. *
  564. *               Fids obtained with the options wLLSameFid and wLLDupFid share
  565. *               a file pointer with the hfs. This file pointer may change after any
  566. *               operation on this FS. The fid obtained with the option wLLSameFid
  567. *               may be closed by FS operations. If it is, the fid is invalid.
  568.  
  569. *
  570. *               NULL can be passed for qfid, qlbase, qlcb and this routine will not
  571. *               pass back the information.
  572. *
  573. * Bugs:   wLLDupFid is unimplemented
  574. *
  575. * +++
  576. *
  577. * Method:   
  578. *
  579. * Notes:   
  580. *
  581. \***************************************************************************/
  582.  
  583. extern RC  (FAR PASCAL *RcLLInfoFromHf  ) ( HF,     WORD, int FAR *, LONG FAR *, LONG FAR * );
  584.  
  585. /***************************************************************************\
  586.  
  587. *
  588. - Function:   RcLLInfoFromHfsSz( hfs, sz, wOption, qfid, qlBase, qlcb )
  589. -
  590. * Purpose:   map an HF into low-level file info
  591. *
  592. * ASSUMES
  593. *  args IN:   hfs - an open HFS
  594. *                  szName - name of file in FS
  595. *                  qfid, qlBase, qlcb - pointers to user's variables
  596. *                  wOption - wLLSameFid, wLLDupFid, or wLLNewFid
  597. *
  598. * PROMISES
  599. *  returns:   RcFSError(); rcSuccess on success
  600. *
  601. *  args OUT:   qfid  - depending on value of wOption, either the same fid
  602.  
  603. *                                  used by hf, a dup() of this fid, or a new fid obtained by
  604. *                                  reopening the file
  605. *
  606. *                       qlBase - byte offset of first byte in the file
  607. *                       qlcb - size in bytes of the data in the file
  608. *
  609. *  globals OUT:   rcFSError
  610. *
  611. * Notes:   It is possible to read data outside the range specified by *qlBase
  612. *               and *qlcb. Nothing is guaranteed about what will be found. If wOption
  613.  
  614. *               is wLLSameFid or wLLDupFid, and the FS is opened in write mode,
  615. *               this fid will be writable. However, writing is not allowed and may
  616. *               destroy the file system.
  617. *
  618. *               Fids obtained with the options wLLSameFid and wLLDupFid share
  619. *               a file pointer with the hfs. This file pointer may change after any
  620. *               operation on this FS. The fid obtained with the option wLLSameFid
  621. *               may be closed by FS operations. If it is, your fid is invalid.
  622.  
  623. *
  624. *               NULL can be passed for qfid, qlbase, qlcb and this routine will not
  625. *               pass back the information.
  626. *
  627. * Bugs:   wLLDupFid is unimplemented
  628. *
  629. * Method:   calls RcLLInfoFromHf()
  630. *
  631. * Notes:   
  632. *
  633. \***************************************************************************/
  634.  
  635. extern RC  (FAR PASCAL *RcLLInfoFromHfs ) (HFS, LPSTR, WORD, int FAR *, LONG FAR *, LONG FAR * );
  636.  
  637.